#include <stdio.h> 
#include <stdlib.h> 
#include <assert.h>
#define N 10

int main(void) { 
    int matrix[N][N] = {0}; 
    int size;
    
    while(scanf("%d", &size)!=EOF) {
        assert(size%2!=0 && size<10);
        
        int i = 0; 
        int j = (size+1) / 2; 
        int key;
        for(key = 1; key <= size*size; key++) { 
            if((key % size) == 1) 
                i++; 
            else { 
                i--; 
                j++; 
            } 

            if(i == 0) 
                i = size; 
            if(j > size) 
                j = 1; 

            matrix[i - 1][j - 1] = key; 
        } 

        int m, n;
        for(m = 0; m < size; m++) { 
            for(n = 0; n < size; n++) 
                printf("%2d ", matrix[m][n]); 
            printf("\n");
        } 
    }
    return 0; 
} 